################################################################################################################
# Train modified VGG with center loss to predict malignancy
# Recommend to train the model at least 120 epochs
# Precise reproduction of training might be impossible for some unknown reasons due to cuDNN
# However, we claim that the results would be close to our final submission
# Models are trained on two different versions of candidates, v9 and v15
# Each version of candidates includes stage1 test set optionally, distinguished by "test" or "without_test"
# Paths of pre-trained model are fixed, based on the part of 'fp reduction'
# You could train one model with 4 folds simultaneously by using 4 gpus and runing in the background
################################################################################################################

# v9_without_test
## predict at least 120
for fold in {0..3}
do
  python vgg13_v9_train.py -i 0 -w '../../data/tmp_fp_reduction/kaggle_models/cddv9_vgg13shortcutsv2_bs16_valid4/epoch-0140.hdf5' -o '../../data/tmp_classification_branch2/v9_without_test' -d '../../data/tmp_classification_branch1/data/lidc_kaggle_candidates_v9.hdf5' -p '../../data/tmp_classification_branch1/data/3dcnn_candidates_list_v9_4fold_newfold_newlabel.pkl' -f $fold -g 0
done

# v9_test
## predict at least 120
for fold in {0..3}
do
  python vgg13_v9_train.py -i 1 -w '../../data/tmp_fp_reduction/kaggle_models/cddv9_vgg13shortcutsv2_bs16_valid4/epoch-0140.hdf5' -o '../../data/tmp_classification_branch2/v9_test' -d '../../data/tmp_classification_branch1/data/lidc_kaggle_candidates_v9.hdf5' -p '../../data/tmp_classification_branch1/data/3dcnn_candidates_list_v9_4fold_newfold_newlabel.pkl' -f $fold -g 0
done

# v15_without_test
## predict at least 100
for fold in {0..3}
do
  python vgg13_v15_train.py -i 0 -w '../../data/tmp_fp_reduction/kaggle_models/cddv15_vgg13shortcutsv2_valid3/epoch-0027.hdf5' -o '../../data/tmp_classification_branch2/v15_without_test' -d '../../data/tmp_classification_branch1/data/lidc_kaggle_candidates_v15.hdf5' -p '../../data/tmp_classification_branch1/data/3dcnn_cddv15_v2_4fold_alldata.pkl' -f $fold -g 0
done

# v15_test
## predict at least 100
for fold in {0..3}
do
  python vgg13_v15_train.py -i 1 -w '../../data/tmp_fp_reduction/kaggle_models/cddv15_vgg13shortcutsv2_valid3/epoch-0027.hdf5' -o '../../data/tmp_classification_branch2/v15_test' -d '../../data/tmp_classification_branch1/data/lidc_kaggle_candidates_v15.hdf5' -p '../../data/tmp_classification_branch1/data/3dcnn_cddv15_v2_4fold_alldata.pkl' -f $fold -g 0
done
